<?php

namespace app\admin\controller;
use think\Controller;
use think\File;
use think\Request;

class Upload extends Base
{
	//图片上传
    public function upload(){
       $file = request()->file('file');
       $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads/images');
       if($info){
            $getSaveName=str_replace("\\","/",$info->getSaveName());
            echo $getSaveName;
        }else{
            echo $file->getError();
        }
    }
    //文件上传
    public function uploadfile(){
        $file = request()->file('file');
       
        $name = date("Ymd")."/".$file->getInfo()['name'];
       
        $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads/file',$name);
        if($info){
            echo $info->getSaveName();
        }else{
            echo $file->getError();
        }
    }
    

    //会员头像上传
    public function uploadface(){
       $file = request()->file('file');
       $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads/face');
       if($info){
            echo $info->getSaveName();
        }else{
            echo $file->getError();
        }
    }

     //会员头像上传
     public function uploadmemberface(){
        $file = request()->file('file');
        $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads/memberface');
        if($info){
             echo $info->getSaveName();
         }else{
             echo $file->getError();
         }
     }
    public function uploadequip(){
        $file = request()->file('file');
        $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads/equipmentimages');
        if($info){
             echo $info->getSaveName();
         }else{
             echo $file->getError();
         }
     }

}